public class Profile extends Grain
{
	double binSize;
	double [] distribution; // prob. of down as a fcn of R

	// private for now, no bin size changing!
	private Profile (Ising ic, double binSize, int L_reduction)
	{
		super (ic, L_reduction);
		this.binSize = binSize;
		// Need to get dimensions of the ising lattices, assuming they're all
		// equal in size. Longest distance from center will be to the corners
		distribution = new double [(int) (ic.L*Math.sqrt(ic.d)/2/binSize)+3];
	}

	public Profile (Ising ic, int L_reduction) { this (ic, 1.0, L_reduction); }
	
	public Profile (Ising ic) { this (ic, 1.0, 8); }

	public void buildDistribution ()
	{
		int center = findCenter ();
		int [] normalizer = new int [distribution.length];
		for (int i=0; i<ic.N; ++i)
		{
			int L_mult = 1;
			double distance = realDistance (center, i);
			int bin = (int) Math.round (distance/binSize);
			distribution[bin] += (ic.getSpin (i) == -1) ? 1 : 0;
			++normalizer[bin];
		}
		for (int i=0; i<distribution.length; ++i)
			distribution[i] /= normalizer[i];
	}
}
